/**
 * @file 轨迹播放器相关类型定义
 * @description 定义轨迹播放器组件使用的类型接口
 * @date 2024-08-22
 */

// @ts-ignore - uni-app环境下Vue类型导入需要忽略类型检查
import { Ref } from 'vue';

/**
 * 时间提示工具样式接口
 */
export interface TimeTooltipStyle {
  display: string;
  left: string;
}

/**
 * 轨迹播放器属性接口
 */
export interface TrackPlayerProps {
  trackLoaded: boolean;
  currentTime: string;
  formattedDistance: string;
  isPlaying: boolean;
  autoPlay?: boolean;
  distance?: number;
}

/**
 * 轨迹时间范围接口
 */
export interface TrackTimeRange {
  start: string;
  end: string;
  startPercentage: number;
  endPercentage: number;
}

/**
 * 时间范围状态接口
 */
export interface TimeRangeState {
  start: Ref<string>;
  end: Ref<string>;
  startPercentage: Ref<number>;
  endPercentage: Ref<number>;
}

/**
 * 拖动类型
 */
export type DragType = 'main' | 'rangeStart' | 'rangeEnd' | null;

/**
 * 轨迹播放器选项接口
 */
export interface TrackPlayerOptions {
  /** 是否自动播放 */
  autoPlay?: boolean;
  /** 是否启用范围选择 */
  enableRangeSelection?: boolean;
  /** 初始播放速度 */
  initialSpeed?: number;
}

/**
 * 轨迹播放器状态接口
 */
export interface TrackPlayerState {
  currentSpeed: string;
  progressPercentage: number;
  formattedCurrentTime: string;
  showRangeSelection: boolean;
  startTimePercentage: number;
  endTimePercentage: number;
  formattedStartTime: string;
  formattedEndTime: string;
  rangeSelectionStyle: { left: string; width: string };
  showStartTimeDropdown: boolean;
  showEndTimeDropdown: boolean;
  tooltipTime: string;
  timeTooltipStyle: TimeTooltipStyle;
  sliderStyle: Record<string, string>;
  sliderThumbStyle: Record<string, string>;
}